###### Configuration ######
outputdir="../documentation/"
###########################

files=`ls *.html`
templates=`ls *.htmp`

# Generate current template output
dt=`date +%d.%m.%Y-%H:%M`
for template in $templates; do
    stripped=`echo $template | cut -d . -f 1`
    sed "s/#DATE#/$dt/" $template >${stripped}
done

for file in $files; do
    awk '/<!---[a-zA-Z0-9]+--->/{gsub("<!---","",$1); gsub("--->","",$1); system("cat " $1); next;}//{print;}' $file >${outputdir}$file
    echo $file output finished
done

